package com.squirrel.factory;

import com.squirrel.facade.SqlOperate;
import org.springframework.stereotype.Component;

/**
 * @author wangyan
 * 此工厂负责产生Select、Update、Delete对象
 */
@Component
public class SqlBuildFactory {

    public <T extends SqlOperate> T create(Class<T> c) {
        SqlOperate sqlOperate = null;
        try {
            sqlOperate = (T) Class.forName(c.getName()).newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return (T) sqlOperate;
    }
}
